<template>
  <div>
    <div class="header">
      <img src="@/assets/hot_music_bg_2x.jpg" alt="">
    </div>

    <MusicList :list="list" :isShow="false">
    <!-- <template v-slot:code="obj">
      <div class="first" :class="{firstRed: obj.index<3}"> {{ obj.index>8?obj.index+1 :'0'+(obj.index+1) }}</div> 
    </template> -->
    </MusicList>
    <!-- 歌曲部分 -->
    <!-- <div class="list">
        <div class="item" v-for="(item,index) in list" :key="item.id">
          <div class="first" :class="{firstRed: index<3}"> {{ index>8?index+1 :'0'+(index+1) }}</div>
          <div class="left">
            <div class="subtitle">{{ item.name }}<span>{{ item.alia[0] }}</span></div>
            <div class="author" ><span  v-for="ele in item.ar" :key="ele.id" class="ele">{{ ele.name }}</span>
            - {{ item.al.name }}</div>
        </div>
        <div class="right"></div>
      </div>
    </div> -->
     
  </div>
</template>

<script>
import MusicList from '@/components/MusicList.vue'
export default {
  data(){
    return{
      list:[]
    }
  },
  components:{MusicList},
  created(){
    this.getHotsong()
  },
methods:{
 async getHotsong(){
  const {data:res} = await this.$api.getHotsong()
    this.list = res.playlist.tracks
  }
}
}
</script>

<style lang="less" scoped>
.header{
  img{
    width: 100%;
  height: 145.95;
  }
}
.list{
  .item{
    display: flex;
  padding: 6px 13px;
  border-bottom: 1px solid #efebeb;
  .firstRed{
    color: df3436;
  }
.first{
    text-align: center;
    justify-content: center;
    font-size: 17px;
    width: 40px;
    color: #999;
    margin-left: -10px;
    margin-top:10px;

  }
  .left{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    flex: 1;
    .subtitle{
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    span{
      overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
      color: #888;
    margin-left: 4px;
    }
  }
  .author{
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    .ele::after{
    content: ' / ';
  }
  .ele:last-child::after{
    content:'' ;
  }
  }
  }
  .right{
    width: .9rem;
  }
}
}

</style>
